﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.css {
    import reprise.core.*;
    import reprise.css.math.*;

    public class CSSProperty implements Cloneable {

        protected var m_calculationResultsCache:Object;
        protected var m_cssFile:String;
        protected var m_important:Boolean;// = false
        protected var m_computedValue:Object = null
        protected var m_isWeak:Boolean;
        protected var m_unit:String = null
        protected var m_inheritsValue:Boolean;// = false
        protected var m_isRelativeValue:Boolean;// = false
        protected var m_isCalculation:Boolean;
        protected var m_id:int;
        protected var m_calculation:AbstractCSSCalculation;
        protected var m_specifiedValue:Object = null

        public static const UNIT_EM:String = "em";
        public static const IMPORTANT_FLAG:String = "!important";
        public static const UNIT_PERCENT:String = "%";
        public static const UNIT_PIXEL:String = "px";
        public static const INHERIT_FLAG:String = "inherit";
        public static const AUTO_FLAG:String = "auto";

        protected static var g_id:int = 0;

        public function CSSProperty(){
            m_id = g_id++;
        }
        public function inheritsValue():Boolean{
            return (m_inheritsValue);
        }
        public function isWeak():Boolean{
            return (m_isWeak);
        }
        public function unit():String{
            return (m_unit);
        }
        public function isAuto():Boolean{
            return ((m_specifiedValue == "auto"));
        }
        public function valueOf():Object{
            if (m_computedValue != null){
                return (m_computedValue);
            };
            return (m_specifiedValue);
        }
        public function setIsWeak(_arg1:Boolean):void{
            m_isWeak = _arg1;
        }
        protected function preprocessCalculation(_arg1:Object):void{
            var _local2:String = _arg1.substring(5, (_arg1.length - 1));
            m_calculation = CSSCalculationGroup.PrepareCalculation(String(_local2));
        }
		public function setUnit(_arg1:String):void{
            if ((((_arg1 == "px")) || ((_arg1 == "em")))){
                m_isRelativeValue = false;
            } else {
                if (_arg1 == "%"){
                    setIsRelativeValue(true);
                };
            };
            m_unit = _arg1;
        }
        public function resolveRelativeValueTo(_arg1:Number, _arg2:ICSSCalculationContext=null):Number{
            if (!m_isRelativeValue){
                return ((((((m_specifiedValue is Number)) && (m_specifiedValue))) || (0)));
            };
            if (m_calculationResultsCache[(_arg1 + m_specifiedValue.toString())]){
                return (m_calculationResultsCache[(_arg1 + m_specifiedValue.toString())]);
            };
            return ((m_calculationResultsCache[(_arg1 + m_specifiedValue.toString())] = resolveCalculation(_arg1, _arg2)));
        }
        public function setCSSFile(_arg1:String):void{
            m_cssFile = _arg1;
        }
        public function cssFile():String{
            return (m_cssFile);
        }
        public function important():Boolean{
            return (m_important);
        }
        public function setSpecifiedValue(_arg1):void{
            m_specifiedValue = _arg1;
            if (m_specifiedValue == 150){
                m_specifiedValue;
            };
            if (_arg1 == "auto"){
                m_computedValue = 0;
            } else {
                if (m_isRelativeValue){
                    if (m_isCalculation){
                        preprocessCalculation(_arg1);
                    } else {
                        m_calculation = new CSSCalculationPercentage(_arg1.toString());
                    };
                } else {
                    if (m_unit == "em"){
                        m_computedValue = (_arg1 * 16);
                    } else {
                        m_computedValue = null;
                    };
                };
            };
        }
        public function toString():String{
            var _local1 = "property {\n";
            _local1 = (_local1 + (("\tspecified Value : " + m_specifiedValue) + "\n"));
            _local1 = (_local1 + (("\tcomputed Value : " + m_computedValue) + "\n"));
            _local1 = (_local1 + (("\tunit : " + m_unit) + "\n"));
            _local1 = (_local1 + (("\timportant : " + m_important) + "\n"));
            _local1 = (_local1 + (("\tweak : " + m_isWeak) + "\n"));
            return (_local1);
        }
        protected function resolveCalculation(_arg1:Number, _arg2:ICSSCalculationContext=null):Number{
            return (m_calculation.resolve(_arg1, _arg2));
        }
		public function setImportant(_arg1:Boolean):void{
            m_important = _arg1;
        }
        public function specifiedValue(){
            return (m_specifiedValue);
        }
        public function clone(_arg1:Boolean=false):Cloneable{
            var _local3:int;
            var _local4:Array;
            var _local5:Array;
            var _local2:CSSProperty = new CSSProperty();
            _local2.m_important = m_important;
            _local2.m_isWeak = m_isWeak;
            _local2.m_unit = m_unit;
            _local2.m_inheritsValue = m_inheritsValue;
            _local2.m_isRelativeValue = m_isRelativeValue;
            if (m_isRelativeValue){
                _local2.m_calculationResultsCache = m_calculationResultsCache;
                _local2.m_calculation = m_calculation;
            };
            _local2.m_cssFile = m_cssFile;
            if (_arg1){
                if ((m_specifiedValue is Cloneable)){
                    _local2.m_specifiedValue = Cloneable(m_specifiedValue).clone(true);
                    if (m_computedValue){
                        _local2.m_computedValue = Cloneable(m_computedValue).clone(true);
                    };
                } else {
                    if ((m_specifiedValue is Array)){
                        _local4 = (m_specifiedValue as Array).concat();
                        if ((_local4[_local3] is Cloneable)){
                            _local3 = _local4.length;
                            while (_local3--) {
                                _local4[_local3] = Cloneable(_local4[_local3]).clone(true);
                            };
                        };
                        _local2.m_specifiedValue = _local4;
                        if (m_computedValue){
                            _local5 = (m_computedValue as Array).concat();
                            if ((_local5[_local3] is Cloneable)){
                                _local3 = _local5.length;
                                while (_local3--) {
                                    _local5[_local3] = Cloneable(_local5[_local3]).clone(true);
                                };
                            };
                            _local2.m_computedValue = _local5;
                        };
                    } else {
                        _local2.m_specifiedValue = m_specifiedValue;
                        _local2.m_computedValue = m_computedValue;
                    };
                };
            } else {
                _local2.m_specifiedValue = m_specifiedValue;
                _local2.m_computedValue = m_computedValue;
            };
            return (_local2);
        }
        function setIsRelativeValue(_arg1:Boolean):void{
            m_isRelativeValue = _arg1;
            m_calculationResultsCache = {};
            if (m_specifiedValue){
                setSpecifiedValue(m_specifiedValue);
            };
        }
        public function isRelativeValue():Boolean{
            return (m_isRelativeValue);
        }
        function setIsCalculation(_arg1:Boolean):void{
            m_isCalculation = _arg1;
            if (_arg1){
                m_calculationResultsCache = {};
                m_isRelativeValue = true;
                if (m_specifiedValue){
                    preprocessCalculation(m_specifiedValue);
                };
            };
        }
		public function setInheritsValue(_arg1:Boolean):void{
            m_inheritsValue = _arg1;
        }
        public function isCalculation():Boolean{
            return (m_isCalculation);
        }

    }
}//package reprise.css 
